

'''
    需求：用户名唯一化 pickle了解 转text实现

'''
import  requests
import hashlib

with open('D:\\2.txt','r') as fp:
    b= fp.read().strip()


with open('D:\\2.txt','w') as fp:
    fp.write(str(int(b)+1)+'\n')

username= 'kkkkk' + b
req= requests.post(url='http://101.42.247.45:8080/register/',
                  data='{"username":"%s","password":"12345678abc","email":"wxh@qq.com"}' %(username,))

print(9,req.text)


m5= hashlib.md5()
m5.update('12345678abc'.encode('utf-8'))
pwd= m5.hexdigest()
print(pwd)



req= requests.post(url='http://101.42.247.45:8080/register/',
                  data='{"username":"%s","password":"%s","email":"wxh@qq.com"}' %(username,pwd,))

#接口响应的字符串内容
print(111,req.text)
#http协议状态码
print(2,req.status_code)

print(req.json())#dict类型
print(type(req.json()))#dict类型
print(req.json()['code'])